package com.prs.crm.action;

import java.util.Collection;
import org.apache.struts2.convention.annotation.Action;
import org.courser.struts.BaseAction;
import com.prs.crm.context.AppContext;
import com.prs.crm.domain.crm.Liaison;
import com.prs.crm.domain.crm.Linkman;
import com.prs.crm.domain.hr.LeaveAudit;
import com.prs.crm.domain.hr.Payroll;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.domain.hr.Train;
import com.prs.crm.domain.oa.Affiche;
import com.prs.crm.domain.oa.Memo;
import com.prs.crm.domain.oa.Notice;
import com.prs.crm.domain.oa.OaTaskSubmit;
import com.prs.crm.domain.oa.Regulation;
import com.prs.crm.domain.oa.Schedule;
import com.prs.crm.domain.oa.Synod;
import com.prs.crm.domain.oa.WorkSummary;
import com.prs.crm.domain.project.Task;
import com.prs.crm.service.crm.CustomerAppointService;
import com.prs.crm.service.crm.LinkmanService;
import com.prs.crm.service.hr.LeaveAuditService;
import com.prs.crm.service.hr.PayrollService;
import com.prs.crm.service.hr.TrainService;
import com.prs.crm.service.oa.AfficheService;
import com.prs.crm.service.oa.ApplyAuditService;
import com.prs.crm.service.oa.MemoService;
import com.prs.crm.service.oa.NoticeService;
import com.prs.crm.service.oa.OaTaskSubmitService;
import com.prs.crm.service.oa.RegulationService;
import com.prs.crm.service.oa.ScheduleService;
import com.prs.crm.service.oa.SynodService;
import com.prs.crm.service.oa.WorkSummaryService;
import com.prs.crm.service.project.TaskService;
import com.prs.crm.vo.project.TaskStatVo;

public class DefaultAction extends BaseAction {
	
	private static final long serialVersionUID = 1L;
	
	private AfficheService afficheService;	
	private RegulationService regulationService;	
	private ApplyAuditService applyAuditService;	
	private MemoService memoService;	
	private ScheduleService scheduleService;		
	private LinkmanService linkmanService;	
	private NoticeService noticeService;	
	private SynodService synodService;
	private OaTaskSubmitService oaTaskSubmitService;
	private WorkSummaryService workSummaryService;
	private LeaveAuditService leaveAuditService;
	private TrainService trainService;
	private PayrollService payrollService;	
	private TaskService taskService;
	private CustomerAppointService customerAppointService;
	private Collection<Affiche> affiches;	
	private Collection<Regulation> regulations;	
	private Collection<Memo> memos;	
	private Collection<Notice> notices;	
	private Collection<Schedule> schedules;
	private Collection<Schedule> exeSchedules;
	private Collection<Schedule> auditSchedules;	
	private Collection<Synod> synods;
	private Collection<OaTaskSubmit> exeOaTaskSubmits;
	private Collection<OaTaskSubmit> auditOaTaskSubmits;
	private Collection<LeaveAudit> leaveAudits;
	private Collection<Train> trains;
	private Collection<Payroll> payrolls;
	private Collection<Task> tasks;
	private Collection<Linkman> birthdayLinkmans;
	private Collection<Liaison> dueLiaisons;
	private Collection<WorkSummary> workSummaryAudits;
	private Collection<WorkSummary> workSummaryCritiques;
	
	private TaskStatVo taskStatVo;
	
	

	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	public AfficheService getAfficheService() {
		return afficheService;
	}

	
	public Collection<WorkSummary> getWorkSummaryAudits() {
		return workSummaryAudits;
	}

	public void setWorkSummaryAudits(Collection<WorkSummary> workSummaryAudits) {
		this.workSummaryAudits = workSummaryAudits;
	}

	public Collection<WorkSummary> getWorkSummaryCritiques() {
		return workSummaryCritiques;
	}

	public void setWorkSummaryCritiques(Collection<WorkSummary> workSummaryCritiques) {
		this.workSummaryCritiques = workSummaryCritiques;
	}

	public void setRegulationService(RegulationService regulationService) {
		this.regulationService = regulationService;
	}
	
	public RegulationService getRegulationService() {
		return regulationService;
	}



	public void setAfficheService(AfficheService afficheService) {
		this.afficheService = afficheService;
	}


	public ApplyAuditService getApplyAuditService() {
		return applyAuditService;
	}

	public TaskService getTaskService() {
		return taskService;
	}

	public void setTaskService(TaskService taskService) {
		this.taskService = taskService;
	}

	public void setApplyAuditService(ApplyAuditService applyAuditService) {
		this.applyAuditService = applyAuditService;
	}

	public MemoService getMemoService() {
		return memoService;
	}

	public void setMemoService(MemoService memoService) {
		this.memoService = memoService;
	}

	public ScheduleService getScheduleService() {
		return scheduleService;
	}

	public void setScheduleService(ScheduleService scheduleService) {
		this.scheduleService = scheduleService;
	}

	public LinkmanService getLinkmanService() {
		return linkmanService;
	}

	public void setLinkmanService(LinkmanService linkmanService) {
		this.linkmanService = linkmanService;
	}

	public void setAffiches(Collection<Affiche> affiches) {
		this.affiches = affiches;
	}

	public Collection<Affiche> getAffiches() {
		return affiches;
	}


	public Collection<Regulation> getRegulations() {
		return regulations;
	}


	public void setRegulations(Collection<Regulation> regulations) {
		this.regulations = regulations;
	}

	public void setMemos(Collection<Memo> memos) {
		this.memos = memos;
	}

	public Collection<Memo> getMemos() {
		return memos;
	}

	public void setNoticeService(NoticeService noticeService) {
		this.noticeService = noticeService;
	}

	public NoticeService getNoticeService() {
		return noticeService;
	}

	public void setTasks(Collection<Task> tasks) {
		this.tasks = tasks;
	}

	public Collection<Task> getTasks() {
		return tasks;
	}

	public void setNotices(Collection<Notice> notices) {
		this.notices = notices;
	}

	public Collection<Notice> getNotices() {
		return notices;
	}

	public void setTaskStatVo(TaskStatVo taskStatVo) {
		this.taskStatVo = taskStatVo;
	}

	public TaskStatVo getTaskStatVo() {
		return taskStatVo;
	}

	public void setSchedules(Collection<Schedule> schedules) {
		this.schedules = schedules;
	}

	public Collection<Schedule> getSchedules() {
		return schedules;
	}


	public void setSynodService(SynodService synodService) {
		this.synodService = synodService;
	}

	public SynodService getSynodService() {
		return synodService;
	}

	public void setSynods(Collection<Synod> synods) {
		this.synods = synods;
	}

	public Collection<Synod> getSynods() {
		return synods;
	}

	public void setExeSchedules(Collection<Schedule> exeSchedules) {
		this.exeSchedules = exeSchedules;
	}

	public Collection<Schedule> getExeSchedules() {
		return exeSchedules;
	}

	public void setAuditSchedules(Collection<Schedule> auditSchedules) {
		this.auditSchedules = auditSchedules;
	}

	public Collection<Schedule> getAuditSchedules() {
		return auditSchedules;
	}

	public void setOaTaskSubmitService(OaTaskSubmitService oaTaskSubmitService) {
		this.oaTaskSubmitService = oaTaskSubmitService;
	}

	public OaTaskSubmitService getOaTaskSubmitService() {
		return oaTaskSubmitService;
	}

	public void setAuditOaTaskSubmits(Collection<OaTaskSubmit> auditOaTaskSubmits) {
		this.auditOaTaskSubmits = auditOaTaskSubmits;
	}

	public Collection<OaTaskSubmit> getAuditOaTaskSubmits() {
		return auditOaTaskSubmits;
	}

	public void setExeOaTaskSubmits(Collection<OaTaskSubmit> exeOaTaskSubmits) {
		this.exeOaTaskSubmits = exeOaTaskSubmits;
	}

	public Collection<OaTaskSubmit> getExeOaTaskSubmits() {
		return exeOaTaskSubmits;
	}

	public void setLeaveAudits(Collection<LeaveAudit> leaveAudits) {
		this.leaveAudits = leaveAudits;
	}

	public Collection<LeaveAudit> getLeaveAudits() {
		return leaveAudits;
	}

	public void setLeaveAuditService(LeaveAuditService leaveAuditService) {
		this.leaveAuditService = leaveAuditService;
	}

	public LeaveAuditService getLeaveAuditService() {
		return leaveAuditService;
	}

	public void setTrainService(TrainService trainService) {
		this.trainService = trainService;
	}

	public TrainService getTrainService() {
		return trainService;
	}

	public void setTrains(Collection<Train> trains) {
		this.trains = trains;
	}

	public Collection<Train> getTrains() {
		return trains;
	}

	public void setPayrollService(PayrollService payrollService) {
		this.payrollService = payrollService;
	}

	public PayrollService getPayrollService() {
		return payrollService;
	}

	public void setPayrolls(Collection<Payroll> payrolls) {
		this.payrolls = payrolls;
	}
	

	public Collection<Payroll> getPayrolls() {
		return payrolls;
	}
	@Action("default")
	public String execute() {
		Person person = AppContext.getAccountContext().currentUser();
		
		affiches = this.getAfficheService().getAfficheByUserCount(5);
		regulations=this.getRegulationService().getRegulationByUserCount(20);
		
		memos = this.getMemoService().getUndealMemo(person);
		notices = this.getNoticeService().getUnreadNotice(person);
		exeSchedules = this.getScheduleService().getExecuteSchedule(person);
		setAuditSchedules(this.getScheduleService().getAuditSchedule(person));
		exeOaTaskSubmits = this.getOaTaskSubmitService().getExecuteTask(person);
		auditOaTaskSubmits = this.getOaTaskSubmitService().getAuditTask(person);

		//workSummaryCritiques=this.getWorkSummaryService().getWorkSummaryCritique(person);
		
		leaveAudits = this.getLeaveAuditService().getAuditLeave(person);
		trains = this.getTrainService().getTrainByPerson(person);
		payrolls = this.getPayrollService().getPayrollByPerson(person);
		taskStatVo = new TaskStatVo();
		taskStatVo.setExecuteTaskCount(this.getTaskService().countExecuteTask(person));
		taskStatVo.setJoinTaskCount(this.getTaskService().countJoinTask(person));
		taskStatVo.setVerifyTaskCount(this.getTaskService().countVerifyTask(person));
		taskStatVo.setReportSubmitTaskCount(this.getTaskService().countSumitReportTask(person));
		taskStatVo.setInValidTaskCount(this.getTaskService().countInValidTask(person));

		this.setBirthdayLinkmans(this.getCustomerAppointService().getTodayBirthdayLinkman4Appoint(person));
		this.setDueLiaisons(this.getCustomerAppointService().getTodayDueLiaison4Appoint(person));

		return SUCCESS;
	}

	public WorkSummaryService getWorkSummaryService() {
		return workSummaryService;
	}

	public void setWorkSummaryService(WorkSummaryService workSummaryService) {
		this.workSummaryService = workSummaryService;
	}

	public void setCustomerAppointService(CustomerAppointService customerAppointService) {
		this.customerAppointService = customerAppointService;
	}

	public CustomerAppointService getCustomerAppointService() {
		return customerAppointService;
	}

	public void setBirthdayLinkmans(Collection<Linkman> birthdayLinkmans) {
		this.birthdayLinkmans = birthdayLinkmans;
	}

	public Collection<Linkman> getBirthdayLinkmans() {
		return birthdayLinkmans;
	}

	public void setDueLiaisons(Collection<Liaison> dueLiaisons) {
		this.dueLiaisons = dueLiaisons;
	}

	public Collection<Liaison> getDueLiaisons() {
		return dueLiaisons;
	}

	

	public static long getSerialversionuid() {
		return serialVersionUID;
	}


	
}
